﻿<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Admin.aspx.vb" Inherits="_Admin" ValidateRequest="False" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Historical Museum</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="default.css" />

</head>
<body>

<form id="form1" runat="server">
    <asp:AccessDataSource ID="article" runat="server" 
        DataFile="~/Database.mdb"         
        
        SelectCommand="SELECT * FROM [Article] WHERE ([categoryId] = ?) ORDER BY [timeOfPost] DESC" 
        ConflictDetection="CompareAllValues" 
        DeleteCommand="DELETE FROM [Article] WHERE [ID] = ?" 
        OldValuesParameterFormatString="original_{0}"
        InsertCommand="INSERT INTO [Article] ([categoryId], [title], [content], [timeOfPost], [timeOfEdit]) VALUES (?, ?, ?, NULL, NULL)" 
        UpdateCommand="UPDATE [Article] SET [categoryId] = ?, [title] = ?, [content] = ?, [timeOfEdit] = NULL WHERE [ID] = ?">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="1" Name="categoryId" 
                QueryStringField="category" Type="Int32" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="original_ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="content" Type="String" />
            <asp:Parameter Name="original_ID" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:QueryStringParameter DefaultValue="1" Name="categoryId" 
                QueryStringField="category" Type="Int32" />           
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="content" Type="String" />
        </InsertParameters>
    </asp:AccessDataSource>
    <asp:AccessDataSource ID="caregory" runat="server" 
        DataFile="~/Database.mdb"         
        SelectCommand="SELECT * FROM [Category] ORDER BY [weight], [name], [ID]" 
        DeleteCommand="DELETE FROM [Category] WHERE [ID] = ?" 
        InsertCommand="INSERT INTO Category(name, weight, description) VALUES (?, ?, ?)" 
        OldValuesParameterFormatString="original_{0}"
        UpdateCommand="UPDATE [Category] SET [name] = ?, [weight] = ?, [description] = ? WHERE [ID] = ?">
        <DeleteParameters>
            <asp:Parameter Name="original_ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="name" Type="String" />
            <asp:Parameter Name="weight" Type="Byte" />
            <asp:Parameter Name="description" Type="String" />
            <asp:Parameter Name="original_ID" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="name" Type="String" />
            <asp:Parameter Name="weight" Type="Int32" />
            <asp:Parameter Name="description" Type="String" />
        </InsertParameters>
    </asp:AccessDataSource>
<div id="header">
<a href="#"><img src="images/logo.png" alt="Ocean" /></a>
<div id="rightmenu">
    <table><tr>
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" 
        DataSourceID="caregory" >
        <ItemTemplate>
        <td runat="server" style="">
                <div><asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete"/></div>
                <div><asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" /></div>
                <div><a href="?category=<%# Eval("ID") %>"><%# Eval("name") %></a></div>
        </td>
        </ItemTemplate>
        <AlternatingItemTemplate>
        <td id="Td1" runat="server" style="">
                <div><asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete" /></div>
                <div><asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" /></div>
                <div><a href="?category=<%# Eval("ID") %>"><%# Eval("name") %></a></div>
        </td>
        </AlternatingItemTemplate>
        <EmptyDataTemplate>
            <table style="">
                <tr>
                    <td>
                        No data was returned.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <LayoutTemplate>
            <table runat="server" border="0" style="position:relative; top:-53px; text-align: center">
                <tr ID="itemPlaceholderContainer" runat="server">
                    <td ID="itemPlaceholder" runat="server">
                    </td>                    
                    <td style="vertical-align:bottom">
                        <a href="giftshop.aspx">Gift shop</a>
                    </td>
                </tr>
            </table>
            <div style="">
            </div>
        </LayoutTemplate>
        <EditItemTemplate>
            <td runat="server" style="font-size:small; text-align:right">
                <asp:Label style="display:none" ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                <table>
                    <tr>
                        <td>Name:</td>
                        <td>
                            <asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td><asp:RangeValidator ID="weightValidator" runat="server" 
                                ControlToValidate="weightTextBox" ErrorMessage="0-255" 
                                MaximumValue="255" MinimumValue="0" Type="Integer" />
                            Weight:</td>
                        <td>
                            <asp:TextBox ID="weightTextBox" runat="server" Text='<%# Bind("weight") %>' />
                        </td>
                    </tr>                    
                    <tr>
                        <td>Description:</td>
                        <td>
                            <asp:TextBox ID="descriptionTextBox" runat="server" Text='<%# Bind("description") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="text-align:center">
                            <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                                Text="Update" />
                            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                                Text="Cancel" />
                        </td>
                    </tr>         
                </table>
            </td>
        </EditItemTemplate>
    </asp:ListView>
    </tr></table>
</div></div>
<div id="banner">Banner</div>
<div id="main">
<div id="leftmenu">
<div style="clear:both"></div>
<br />
<div id="bg-left" class="a">
<div id="sidebar" class="b">
<div id="categ">Categories</div>
<div style="clear:both"></div>
<ul>					
	<li><a href="Default.aspx" target="_blank">Frontend</a></li>						
	<li><a href="#">Sub navagator 2</a></li>	
	<li><a href="#">Sub navagator 3</a></li>				
</ul>
</div>
</div>
<div id="ads"><a href="#"><img src="images/ads1.jpg" alt="ads1" /></a><br /><br /><a href="#"><img src="images/ads2.jpg" alt="ads2" /></a><br /><br /><a href="#"><img src="images/ads3.jpg" alt="ads3" /></a></div>
</div>
<div id="image">
<img src="images/1321488911_ba31408a9d_b.jpg"  alt="ocean" width="740" height="366" />
<div id="content">
<div id="page">
    <asp:FormView ID="FormView1" runat="server" DataSourceID="caregory">
        <InsertItemTemplate>
        <table>
        <tr>
        <td colspan="2" style="text-align:center"><h1>New Category</h1></td>
        </tr>
        <tr>
        <td>Name:</td>
        <td><asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>' /></td>
        </tr>
        <tr>
        <td>Weight:</td>
        <td>
        <asp:TextBox ID="weightTextBox" runat="server" Text='<%# Bind("weight") %>' />
        <asp:RangeValidator ID="weightValidator" runat="server" 
        ControlToValidate="weightTextBox" ErrorMessage="R0-255" 
        MaximumValue="255" MinimumValue="0" EnableClientScript="True" Type="Integer">
        </asp:RangeValidator>        
        </td>
        </tr>
        <tr>
        <td>Description:</td>
        <td><asp:TextBox ID="descriptionTextBox" runat="server" 
                Text='<%# Bind("description") %>' />
        </td>
        </tr>
        <tr>
        <td colspan="2">
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Insert" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" /></td>
        </tr>
        </table>
        </InsertItemTemplate>
        <ItemTemplate>
            <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="New Category" />
        </ItemTemplate>
    </asp:FormView>
    
    
    
    <br />
    <asp:FormView ID="FormView2" runat="server" AllowPaging="True"
        DataKeyNames="ID" DataSourceID="article" 
        PagerSettings-Mode="NumericFirstLast" Width="100%">
<PagerSettings Mode="NumericFirstLast" PageButtonCount="5"></PagerSettings>
        <EditItemTemplate>
        <script type="text/javascript" src="fckeditor/fckeditor.js"></script>
        <script type="text/javascript">
            window.onload = function() {
                var oFCKeditor = new FCKeditor('FormView2$contentTextBox');
                oFCKeditor.BasePath = "fckeditor/";
                oFCKeditor.ReplaceTextarea();
            }
        </script>
            <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' />
            <asp:TextBox ID="contentTextBox" runat="server" Text='<%# Bind("content") %>' 
                Width="100%" TextMode="MultiLine" Rows="100" />
            <div style="text-align:center">
            <asp:Button ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Update" />
            <asp:Button ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                </div>
        </EditItemTemplate>
        <InsertItemTemplate>
        <script type="text/javascript" src="fckeditor/fckeditor.js"></script>
        <script type="text/javascript">
   window.onload = function() {
        var oFCKeditor = new FCKeditor('FormView2$contentTextBox');
        oFCKeditor.BasePath = "fckeditor/";
        oFCKeditor.ReplaceTextarea();
    }
        </script>
            <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' />
            <asp:TextBox ID="contentTextBox" runat="server" Text='<%# Bind("content") %>' 
                Width="100%" TextMode="MultiLine" Rows="100" />
            <div style="text-align:center">
            <asp:Button ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Insert" />
            <asp:Button ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                </div>
        </InsertItemTemplate>
        <ItemTemplate>
            <h1><asp:Label ID="titleLabel" runat="server" Text='<%# Bind("title") %>' /></h1>
            <div style="text-align:left">
            <asp:Label ID="contentLabel" runat="server" Text='<%# Bind("content") %>' />
            </div>
            <div style="text-align:right">
            Create:
            <asp:Label ID="timeOfPostLabel" runat="server" 
                Text='<%# Bind("timeOfPost") %>' />
            </div>
            <div style="text-align:right">
            Last edit:
            <asp:Label ID="timeOfEditLabel" runat="server" 
                Text='<%# Bind("timeOfEdit") %>' />
            </div>
            <div style="text-align:center"><asp:Button ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="Edit" />
            &nbsp;<asp:Button ID="DeleteButton" runat="server" CausesValidation="False" 
                CommandName="Delete" Text="Delete" />
            &nbsp;<asp:Button ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="New" />
                </div>
        </ItemTemplate>
        <EmptyDataTemplate>
            No artile
            <div style="text-align:center"><asp:Button ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="New" />
                </div>
        </EmptyDataTemplate>      
    </asp:FormView>
    </div>
</div></div>
</div>
<div style="clear:both"></div>
<div id="footer">
<div id="footer-text">
Copyright &copy; 2009 <a href="#">Himury.co.cc</a>.<br />
All rights reserved.<br />
Hotline: +358 (40) 130525<br />
Valid: <a href="http://validator.w3.org/check/referer">XHTML</a> | <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>
</div>
</div>
</form></body>
</html>